package eventos;

import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.JFrame;

class ComWindowListener extends JFrame {
ComWindowListener () {
this.setTitle("Não Usando um Window Adapter");
this.setSize(400, 400);
this.setVisible(true);
this.addWindowListener(new WindowListener() {
@Override
public void windowClosing(WindowEvent evt) {
System.exit(0);
}
@Override
public void windowClosed(WindowEvent evt) {}
@Override
public void windowDeactivated(WindowEvent evt) {}
@Override
public void windowDeiconified(WindowEvent evt) {}
@Override
public void windowIconified(WindowEvent evt) {}
@Override
public void windowOpened(WindowEvent evt) {}
@Override
public void windowActivated(WindowEvent evt) {}
});

}
public static void main(String[] args) {
new ComWindowListener();
}
}
